/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.common.systemmessage.controller;

import com.icinfo.cloud.common.core.page.BasePageRequest;
import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.punish.common.systemmessage.dto.SystemMessageIdRequestDto;
import com.icinfo.cloud.provider.punish.common.systemmessage.dto.SystemMessageInsertDto;
import com.icinfo.cloud.provider.punish.common.systemmessage.service.ICaseSystemMessageService;
import com.icinfo.cloud.provider.punish.common.systemmessage.vo.SystemMessageListInfoVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 描述:  case_system_message 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年12月09日
 */
@RestController
@Slf4j
@RequestMapping("/punish/common/systemMessage")
public class CaseSystemMessageController extends BaseController {

    @Resource
    private ICaseSystemMessageService caseSystemMessageService;

    /**
     * 查询消息提醒列表
     *
     * @param pageQueryDto 消息提醒列表结果 VO
     * @return com.icinfo.framework.common.web.Result<com.icinfo.cloud.common.core.page.PageResponse < com.icinfo.cloud.provider.punish.common.systemmessage.vo.SystemMessageListInfoVo>>
     * @author yangsizhen
     * @date 2022/12/09
     */
    @PostMapping(value = "/getSystemMessageList")
    @ApiOperation(value = "描述：查询消息提醒列表", httpMethod = "POST")
    public Result<PageResponse<SystemMessageListInfoVo>> getFactorInfoList(@RequestBody BasePageRequest pageQueryDto) {
        return Result.success("查询成功", new PageResponse<>(caseSystemMessageService.getSystemMessageList(pageQueryDto)));
    }

    /**
     * 消息标记已读
     *
     * @param systemMessageIdRequestDto 消息提醒id请求Dto
     * @return com.icinfo.framework.common.web.Result<java.lang.String>
     * @author yangsizhen
     * @date 2022/12/09
     */
    @PostMapping(value = "/updateSystemMessageRead")
    @ApiOperation(value = "描述：消息标记已读", httpMethod = "POST")
    public Result<String> updateSystemMessageRead(@RequestBody SystemMessageIdRequestDto systemMessageIdRequestDto) {
        return caseSystemMessageService.updateSystemMessageRead(systemMessageIdRequestDto);
    }

    /**
     * 查询详细未读数量
     *
     * @return com.icinfo.framework.common.web.Result<java.lang.Integer>
     * @author yangsizhen
     * @date 2022/12/09
     */
    @PostMapping(value = "/getNoReadMessageCount")
    @ApiOperation(value = "描述：查询详细未读数量", httpMethod = "POST")
    public Result<Integer> getNoReadMessageCount() {
        return caseSystemMessageService.getNoReadMessageCount();
    }

    /**
     * 查询当前用户最新未读消息
     *
     * @return com.icinfo.framework.common.web.Result<com.icinfo.cloud.provider.punish.common.systemmessage.vo.SystemMessageListInfoVo>
     * @author yangsizhen
     * @date 2022/12/12
     */
    @PostMapping(value = "/getNoReadMessageFirstInfo")
    @ApiOperation(value = "描述：查询当前用户最新未读消息", httpMethod = "POST")
    public Result<SystemMessageListInfoVo> getNoReadMessageFirstInfo() {
        return caseSystemMessageService.getNoReadMessageFirstInfo();
    }
}